home *** CD-ROM | disk | FTP | other *** search
/ Hardcore Visual Basic 5.0 (2nd Edition) / Hardcore Visual Basic 5.0 - Second Edition (1997)(Microsoft Press).iso / Code / Short.cls < prev    next >
Text File  |  1997-06-14  |  2KB  |  75 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "GShort"
  6. Attribute VB_GlobalNameSpace = True
  7. Attribute VB_Creatable = True
  8. Attribute VB_PredeclaredId = False
  9. Attribute VB_Exposed = True
  10. Option Explicit
  11.  
  12. Public Enum EErrorShort
  13.     eeBaseShort = 13610     ' Short
  14. End Enum
  15.  
  16.  
  17. Sub CreateShortcut(LinkFile As Variant, _
  18.                    Path As String, _
  19.                    Optional DisplayMode As Long = edmNormal, _
  20.                    Optional WorkingDirectory As String, _
  21.                    Optional Arguments As String, _
  22.                    Optional Description As String, _
  23.                    Optional IconIndex As Long = 0)
  24.     Dim shortcut As New CShortcut
  25.     With shortcut
  26.         .Path = Path
  27.         .WorkingDirectory = WorkingDirectory
  28.         .DisplayMode = DisplayMode
  29.         .Arguments = Arguments
  30.         .Description = Description
  31.         .Icon = IconIndex
  32.         .Save LinkFile
  33.     End With
  34. End Sub
  35.  
  36. Sub UpdateShortcut(LinkFile As String, _
  37.                    Optional Path As String, _
  38.                    Optional WorkingDirectory As String, _
  39.                    Optional DisplayMode As Long, _
  40.                    Optional Arguments As String, _
  41.                    Optional Description As String, _
  42.                    Optional Icon As Variant)
  43.     Dim shortcut As New CShortcut
  44.     With shortcut
  45.         .Resolve LinkFile
  46.         Path = .Path
  47.         WorkingDirectory = .WorkingDirectory
  48.         DisplayMode = .DisplayMode
  49.         Arguments = .Arguments
  50.         Description = .Description
  51.         Icon = .Icon
  52.     End With
  53. End Sub
  54.  
  55. #If fComponent = 0 Then
  56. Private Sub ErrRaise(e As Long)
  57.     Dim sText As String, sSource As String
  58.     If e > 1000 Then
  59.         sSource = App.ExeName & ".Short"
  60.         Select Case e
  61.         Case eeBaseShort
  62.             BugAssert True
  63.        ' Case ee...
  64.        '     Add additional errors
  65.         End Select
  66.         Err.Raise COMError(e), sSource, sText
  67.     Else
  68.         ' Raise standard Visual Basic error
  69.         sSource = App.ExeName & ".VBError"
  70.         Err.Raise e, sSource
  71.     End If
  72. End Sub
  73. #End If
  74.  
  75.